﻿<Window x:Class="StressClient.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="StressTester Client" Height="300" Width="450" ResizeMode="NoResize">
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="BoleanToVisibilityConverter" />
    </Window.Resources>
    <Grid>
        <Button Command="{Binding CommandConnect}" Content="Connect" HorizontalAlignment="Left" Margin="345,76,0,0" VerticalAlignment="Top" Width="75" Visibility="{Binding IsNotConnected, Converter={StaticResource BoleanToVisibilityConverter}}" IsEnabled="{Binding IsNotConnecting}">
            <Button.ToolTip>
                <ToolTip>
                    <StackPanel>
                        <TextBlock FontWeight="Bold">Connect</TextBlock>
                        <TextBlock>Connect to server on specified port.</TextBlock>
                    </StackPanel>
                </ToolTip>
            </Button.ToolTip>
        </Button>
        <TextBox HorizontalAlignment="Left" Height="23" Margin="10,77,0,0" TextWrapping="Wrap" Text="{Binding ServerAddress}" VerticalAlignment="Top" Width="205" IsEnabled="{Binding IsNotConnected}">
            <TextBox.ToolTip>
                <ToolTip>
                    <StackPanel>
                        <TextBlock FontWeight="Bold">Server</TextBlock>
                        <TextBlock>Host name / IP address of server to connect to. If the server is running on the same machine as this client leave this empty.</TextBlock>
                    </StackPanel>
                </ToolTip>
            </TextBox.ToolTip>
        </TextBox>
        <TextBox HorizontalAlignment="Left" Height="23" Margin="220,77,0,0" TextWrapping="Wrap" Text="{Binding ServerPort}" VerticalAlignment="Top" Width="85" IsEnabled="{Binding IsNotConnected}">
            <TextBox.ToolTip>
                <ToolTip>
                    <StackPanel>
                        <TextBlock FontWeight="Bold">Port</TextBlock>
                        <TextBlock>Port to use when connecting to server.</TextBlock>
                    </StackPanel>
                </ToolTip>
            </TextBox.ToolTip>
        </TextBox>
        <Label Content="Server" HorizontalAlignment="Left" Margin="10,51,0,0" VerticalAlignment="Top"/>
        <Label Content="Port" HorizontalAlignment="Left" Margin="220,51,0,0" VerticalAlignment="Top"/>
        <ListBox x:Name="Messages" AlternationCount="2" HorizontalAlignment="Left" Height="74" Margin="10,111,0,0" VerticalAlignment="Top" Width="410" ItemsSource="{Binding ServerMessages}"  IsManipulationEnabled="False">
            <ListBox.ToolTip>
                <ToolTip>
                    <StackPanel>
                        
                        <TextBlock>Messages from server.</TextBlock>
                    </StackPanel>
                </ToolTip>
            </ListBox.ToolTip>
        </ListBox>
        <Button Command="{Binding CommandDisconnect}" Content="Disconnect" HorizontalAlignment="Left" Margin="325,77,0,0" VerticalAlignment="Top" Width="95" Visibility="{Binding IsConnected, Converter={StaticResource BoleanToVisibilityConverter}}">
            <Button.ToolTip>
                <ToolTip>
                    <StackPanel>
                        <TextBlock FontWeight="Bold">Disconnect</TextBlock>
                        <TextBlock>Disconnect from server (are you sure?).</TextBlock>
                    </StackPanel>
                </ToolTip>
            </Button.ToolTip>
        </Button>
        <TextBlock HorizontalAlignment="Left" Margin="10,16,0,0" TextWrapping="Wrap" Text="{Binding Status}" VerticalAlignment="Top" Height="35" Width="368" FontSize="20"/>

        <Canvas HorizontalAlignment="Left" Height="60"  VerticalAlignment="Top" Width="455" Margin="0,194,0,0">
            <ProgressBar  HorizontalAlignment="Left" Height="28"  VerticalAlignment="Top" Width="410" Canvas.Left="10" Canvas.Top="22" Maximum="{Binding TotalQueries}" Value="{Binding CompletedQueries}"/>
            <Label Content="Queries" Canvas.Left="267"/>
            <StackPanel Height="16" Canvas.Left="330" Orientation="Horizontal" Canvas.Top="5">
                <TextBlock TextAlignment="Right"  TextWrapping="Wrap" Text="{Binding CompletedQueries}" VerticalAlignment="Top" Width="39"/>
                <TextBlock TextAlignment="Right"  TextWrapping="Wrap" Text="/" VerticalAlignment="Top" Width="8"/>
                <TextBlock TextAlignment="Right"  TextWrapping="Wrap" Text="{Binding TotalQueries}" VerticalAlignment="Top" Width="40"/>
            </StackPanel>
            <Label Content="Errors" Canvas.Left="164"/>
            <TextBlock HorizontalAlignment="Left"  TextWrapping="Wrap" Text="{Binding QueryErrors}" VerticalAlignment="Top" Width="49" Canvas.Left="215" Canvas.Top="5"/>
        </Canvas>
    </Grid>
</Window>
